package com.zbkj.common.vo.project;

/**
 * @Auther:
 * @Date: 2024/9/14 17:04
 * @Description:
 */

import com.alibaba.excel.annotation.ExcelProperty;
import com.google.common.collect.Lists;
import com.zbkj.common.enums.ProjectFunItem1Enum;
import com.zbkj.common.enums.ProjectFunItem2Enum;
import com.zbkj.common.enums.ProjectTypeEnum;
import com.zbkj.common.model.project.EstimateFun;
import com.zbkj.common.model.project.ProjectInfo;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.BeanUtils;

import java.util.List;

/**
 * ai估算结果功能点明细excel解析导入对象
 */
public class AiNotifyFunExcelParseVo {

    @ApiModelProperty("子系统名称")
    @ExcelProperty(index = 0)
    private String subsysName;

    @ApiModelProperty("模块名称")
    @ExcelProperty(index = 1)
    private String moduleName;

    @ApiModelProperty("功能单元名称")
    @ExcelProperty(index = 5)
    private String funName;

    @ApiModelProperty("功能类型")
    @ExcelProperty(index = 3)
    private String funType;

    @ApiModelProperty("功能点数")
    @ExcelProperty(index = 4)
    private String funPoints;

    @ApiModelProperty("功能点描述")
    @ExcelProperty(index = 6)
    private String funDescr;

    @ApiModelProperty("原文索引")
    @ExcelProperty(index = 7)
    private Integer idx;

    @ApiModelProperty("原文位置")
    @ExcelProperty(index = 8)
    private String idxLoc;
    public String getSubsysName() {
        return subsysName;
    }

    public void setSubsysName(String subsysName) {
        this.subsysName = subsysName;
    }

    public String getFunName() {
        return funName;
    }

    public void setFunName(String funName) {
        this.funName = funName;
    }

    public String getFunType() {
        return funType;
    }

    public void setFunType(String funType) {
        this.funType = funType;
    }

    public String getFunPoints() {
        return funPoints;
    }

    public void setFunPoints(String funPoints) {
        this.funPoints = funPoints;
    }

    public String getFunDescr() {
        return funDescr;
    }

    public void setFunDescr(String funDescr) {
        this.funDescr = funDescr;
    }

    public String getModuleName() {
        return moduleName;
    }

    public void setModuleName(String moduleName) {
        this.moduleName = moduleName;
    }

    public Integer getIdx() {
        return idx;
    }

    public void setIdx(Integer idx) {
        this.idx = idx;
    }

    public String getIdxLoc() {
        return idxLoc;
    }

    public void setIdxLoc(String idxLoc) {
        this.idxLoc = idxLoc;
    }

    public static List<EstimateFun> toPojoBatch(ProjectInfo projectInfo, String reqNo, List<AiNotifyFunExcelParseVo> parseFunDataList) {
        List<EstimateFun> efList = Lists.newArrayList();
        int sortNum = 0;
        for(AiNotifyFunExcelParseVo parseVo : parseFunDataList) {
            EstimateFun estimateFun = new EstimateFun();
            BeanUtils.copyProperties(parseVo,estimateFun);
            estimateFun.setProjectId(projectInfo.getId());
            estimateFun.setReqNo(reqNo);
            sortNum += 1;
            estimateFun.setSortNum(sortNum);
            //设置重用程度属性
            ProjectFunItem1Enum.estimateFunSet(projectInfo.getProjectType(),projectInfo.getReuseItem(),estimateFun);
            //设置修改类型属性
            ProjectFunItem2Enum.estimateFunSet(projectInfo.getProjectType(),null,estimateFun);
            efList.add(estimateFun);
        }
        return efList;
    }

}
